package com.wulian.common.util;

public class RegUtil {
	//包含大小写字母、数字、特殊字符至少3个组合大于8个字符
	//public static final String PW_PATTERN_1 = "^(?![A-Za-z]+$)(?![A-Z\\d]+$)(?![A-Z\\W]+$)(?![a-z\\d]+$)(?![a-z\\W]+$)(?![\\d\\W]+$)\\S{8,}$";
    
	//必须是包含大小写字母、数字、特殊符号的8位以上组合
	public static final String PW_PATTERN_1 = "^(?![A-Za-z0-9]+$)(?![a-z0-9\\W]+$)(?![A-Za-z\\W]+$)(?![A-Z0-9\\W]+$)[a-zA-Z0-9\\W]{8,}$";
	//匹配n个相同连续字符
	public static final String PW_PATTERN_2 = "^.*(.)\\1{2}.*$";
	
	public static boolean checkPassword1(String pwd){
		boolean result = false;
		if(pwd.matches(PW_PATTERN_1)){		//匹配进入
			result = true;
		}
		return result;
	}

	public static boolean checkPassword2(String pwd){
		boolean result = false;
		if(!pwd.matches(PW_PATTERN_2)){		//匹配进入
			result = true;
		}
		return result;
	}
	
	public static void main(String[] args) {
		String pwd = "bohaiWulian123@bcig.cn";
		System.out.println(checkPassword1(pwd));
	}
}
